home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PASCAL / 1874.ZIP / T-TOOLS.ZIP / TOOLDOC.ASC < prev    next >
Text File  |  1989-12-20  |  60KB  |  1,333 lines

  1.       ********************************************************************
  2.       *                                                                  *
  3.       *                          Turbo Tools 1.0                         *
  4.       *                                                                  *
  5.       *           for Borland's Turbo Pascal 4.0, 5.0, and 5.5           *
  6.       *                                                                  *
  7.       *                          copyright 1989                          *
  8.       *                                                                  *
  9.       *                         Chuck Esterbrook                         *
  10.       *                                                                  *
  11.       ********************************************************************
  12.  
  13.  
  14.       YOU SHOULD READ ALL OF PART ONE BEFORE USING TURBO TOOLS.
  15.  
  16.       DON'T FORGET TO REGISTER!
  17.  
  18.       I. Introduction
  19.      II. unit Crt2
  20.     III. unit Input
  21.      IV. unit Keys
  22.       V. unit StrFuncs
  23.       ********************************************************************
  24.       *                                                                  *
  25.       *                          Turbo Tools 1.0                         *
  26.       *                                                                  *
  27.       *           for Borland's Turbo Pascal 4.0, 5.0, and 5.5           *
  28.       *                                                                  *
  29.       *                          copyright 1989                          *
  30.       *                                                                  *
  31.       *                         Chuck Esterbrook                         *
  32.       *                                                                  *
  33.       ********************************************************************
  34.  
  35.  
  36.       YOU SHOULD READ ALL OF PART ONE BEFORE USING TURBO TOOLS.
  37.  
  38.       DON'T FORGET TO REGISTER!
  39.  
  40.       I. Introduction
  41.          A. Documentation and printing
  42.             1) Documentation files
  43.             2) TOOLDOC.ASC arrangement
  44.             3) Printing files
  45.          B. Registration
  46.             1) What is shareware?
  47.             2) What you get for registering Turbo Tools
  48.             3) How to register
  49.          C. Disk files
  50.             1) Original disk
  51.             2) Installed
  52.          D. Installation
  53.          E. Using units
  54.  
  55.      II. unit Crt2
  56.          A. Explanation
  57.          B. Initialization Code
  58.          C. Exit Code
  59.          D. Center
  60.          E. CanUseColor
  61.          F. Cursor/CursorState/CursorTypes
  62.          G. DelChar
  63.          H. Frame
  64.          I. GetKey/GetKeyUp
  65.          J. GlobalX/GlobalY
  66.          K. InsSpace
  67.          L. LowBeep
  68.          M. ScrWidth/ScrLength
  69.          N. VideoSeg
  70.          O. WriteLast
  71.  
  72.     III. unit Input
  73.          A. Word of warning
  74.          B. Explanation
  75.          C. Initialization and Exit Code
  76.          D. Escaped
  77.          E. Minimum/Maximum integer range constants
  78.          F. Integer input routines
  79.          G. ReadStr
  80.          H. AllChars
  81.  
  82.      IV. unit Keys
  83.          A. Explanation
  84.          B. Constant Identifiers
  85.             1) Single Code Special Keys
  86.             2) Extended Code Special Keys
  87.          C. Example
  88.  
  89.       V. unit StrFuncs
  90.          A. Explanation
  91.          B. Initialization and Exit Code
  92.          C. CopyEnd
  93.          D. DelOccurs
  94.          E. LowCase
  95.          F. LowStr
  96.          G. PosOccur
  97.          H. Occurs
  98.          I. Shave
  99.          J. ShaveLead
  100.          K. ShaveTrail
  101.          L. UpStr
  102.       ********************************************************************
  103.       *                                                                  *
  104.       *                          Turbo Tools 1.0                         *
  105.       *                                                                  *
  106.       *           for Borland's Turbo Pascal 4.0, 5.0, and 5.5           *
  107.       *                                                                  *
  108.       *                          copyright 1989                          *
  109.       *                                                                  *
  110.       *                         Chuck Esterbrook                         *
  111.       *                                                                  *
  112.       ********************************************************************
  113.  
  114.  
  115.       YOU SHOULD READ ALL OF PART ONE BEFORE USING TURBO TOOLS.
  116.  
  117.       DON'T FORGET TO REGISTER!
  118.  
  119.  
  120.       I. Introduction
  121.  
  122.          A. Documentation and printing
  123.  
  124.             1) Documentation files
  125.                   There are two documentation files for Turbo Tools. The
  126.                first is TOOLINFO.ASC which is a quick list of all types,
  127.                variables, procedures, functions, units, compiler
  128.                directives, and files that make up Turbo Tools. You'll
  129.                definitely want to print this out since it will be a little
  130.                while until you remember all the extra commands at your
  131.                disposal and their parameters. This file will print in 3
  132.                pages.
  133.                   The second file is TOOLDOC.ASC which is the entire
  134.                documentation for Turbo Tools. On printers that put 66
  135.                lines on a page, it will print in 23 pages. On printers
  136.                that put 60 lines on a page, it will print in 25. You can
  137.                view both these files by loading them into Turbo Pascal and
  138.                scrolling through them, although it is strongly recommended
  139.                that you print them out.
  140.  
  141.             2) TOOLDOC.ASC arrangement
  142.                   As you might have noticed, TOOLDOC.ASC is arranged in
  143.                outline format. This is because it was written with an
  144.                outliner/PIM program named GrandView. I wrote the
  145.                documentation with GrandView because I feel that the
  146.                outline format makes it easier to read and thumb through. I
  147.                hope you find it that way, also. The units are documented
  148.                in alphabetical order and the routines in each unit are
  149.                also listed and documented in alphabetical order. I suggest
  150.                that you simply read the documentation page by page,
  151.                instead of leafing through to different sections. The Crt2
  152.                unit, which is documented first, is probably the best unit
  153.                to start out with anyway.
  154.  
  155.             3) Printing files
  156.                   You can print the documentation files from DOS with
  157.                "COPY filename PRN", or you can load them into the Turbo
  158.                Pascal Editor and print them from there (CONTROL-K,
  159.                CONTROL-P).
  160.  
  161.          B. Registration
  162.             1) What is shareware?
  163.                   If you are already familiar with shareware and
  164.                registration fees you can skip this section and go to the
  165.                next one (Section 2).
  166.                   Turbo Tools is a shareware product. Shareware software
  167.                can be distributed freely as long as it is distributed in
  168.                its whole entirety. You can find shareware on BBS's and in
  169.                catalogs that usually charge a small fee, such as $5 per
  170.                disk full of software. You might also be able to copy some
  171.                shareware from your friends. Once you have the shareware
  172.                you can try it out and if you like it and plan to use it
  173.                then you send payment for the software to the author.
  174.                Authors benefit by using the shareware method because there
  175.                is no advertising overhead as with commercial software.
  176.                Customers benefit because the authors pass these savings
  177.                onto them by offering a lower registration fee than what a
  178.                similar commercial product would cost. Customers also get
  179.                to try out the software before they "buy" it.
  180.                   Why should you pay the registration fee when you could
  181.                keep using the program for free? Well, for one thing, if
  182.                you really like the product, then the author probably put a
  183.                lot of work into it. If his program is saving you time and
  184.                helping you work faster or do something that you weren't
  185.                doing before, then you owe him his money. And besides being
  186.                honorable, it's usually in *YOUR* best interests to
  187.                register, because many authors (including this one) offer
  188.                benefits to registered users that you'll definitely want.
  189.  
  190.             2) What you get for registering Turbo Tools
  191.                   The registration free for Turbo Tools is $10. In return
  192.                you get the complete source code for the entire system,
  193.                free unlimited technical support through the mail, notices
  194.                of future updates, and if I find or am alerted of a serious
  195.                bug in the system I'll rush you a letter describing how to
  196.                fix the source code. You'll also be registered for the
  197.                latest version of Turbo Tools. For example, if you are
  198.                registering version 1.0, but a version 2.0 has already been
  199.                released, then I'll simply send you version 2.0, even if
  200.                the registration price is higher.
  201.                   The biggest reason you'll want to register Turbo Tools
  202.                is for the source code, and here's why:
  203.                   First of all, the compiler directives for the units
  204.                can't be changed unless you have the source code. When you
  205.                get the source code you can set the directives to your own
  206.                preferences and recompile the units.
  207.                   What happens if you want one of the routines in Turbo
  208.                Tools to work slightly different than how it does now? If
  209.                you don't have the source code you have to rewrite the
  210.                whole routine from scratch, and if you have no idea how it
  211.                works in the first place then you won't be rewriting
  212.                anything. If you have the source code, however, you can
  213.                examine the routine and make the modifications you want.
  214.                   There's also the problem of TPU's. Every version of
  215.                Turbo Pascal uses a different format for TPU files. Turbo
  216.                Tools includes TPU's for Turbo Pascal 4.0, 5.0, and 5.5,
  217.                but if Borland releases a version 6.0 it will probably also
  218.                use a different TPU format. That would leave you out in the
  219.                cold. The only way to solve that problem is to have the
  220.                source code so you can recompile the units.
  221.                   As you can see, a mere $10 gives you a lot of advantages
  222.                that you definitely could use.
  223.  
  224.             3) How to register
  225.                   To register I'll need your check for $10 made payable to
  226.                Charles Esterbrook and some necessary information that you
  227.                can write on a piece of paper, or if you have bad hand
  228.                writing, you can type it with the Turbo Pascal editor and
  229.                press CONTROL-K, CONTROL-P to print it. The information
  230.                I'll need follows:
  231.  
  232.                      (1) The version of Turbo Tools you are registering,
  233.                      (2) Your version of Turbo Pascal.
  234.                      (3) If you want the source code on floppy disks
  235.                          (5 1/4"), micro disks (3 1/2") or if you have
  236.                          both types of drives and it doesn't matter.
  237.                      (4) And finally, your return address.
  238.  
  239.                   You can expect your new disk and registration ID within
  240.                two weeks. This is my address:
  241.  
  242.                         Chuck Esterbrook
  243.                         Attn: Turbo Tools 1.0
  244.                         4980 West 89th Terrace
  245.                         Crown Point, IN
  246.                                           46307
  247.  
  248.                   To help me separate my business mail from my personal
  249.                mail please include the attention line, and for the sake of
  250.                decreasing the chances of it getting lost in the mail or
  251.                taking a very long time, please put the zip code on a
  252.                separate line by itself, far to the right. Thank you.
  253.  
  254.          C. Disk files
  255.  
  256.             1) Original disk
  257.                   Turbo Tools comes with several files which are listed
  258.                here. If you list a directory and find that you didn't get
  259.                all of the files for Turbo Tools you can send me $5 (for
  260.                the disk and shipping and handling) and I will send you the
  261.                unregistered version of Turbo Tools. Or you can simply send
  262.                $10 and I'll just send you the registered version of Turbo
  263.                Tools. See Part I.B.2. for information concerning
  264.                registration. My address is located in Part I.B.3.
  265.  
  266.                   README.EXE     instructions for getting started with
  267.                                  Turbo Tools
  268.  
  269.                   INSTALL.BAT    installation batch file for Turbo Tools
  270.  
  271.                   CONTINUE.ASC   this file is displayed by INSTALL.BAT
  272.                                  after Turbo Tools has been installed
  273.  
  274.                   TOOLINFO.ASC   quick information about Turbo Tools (for
  275.                                  printing)
  276.  
  277.                   TOOLDOC.ASC    complete documentation for Turbo Tools
  278.                                  (what you're reading right now)
  279.  
  280.                   CRT2DEMO.PAS   demonstration program for the Crt2 and
  281.                                  Keys unit
  282.  
  283.                   *.40           TPU files for Turbo Pascal 4.0
  284.                   *.50           TPU files for Turbo Pascal 5.0
  285.                   *.55           TPU files for Turbo Pascal 5.5
  286.  
  287.             2) Installed
  288.                   The installation program will install the following
  289.                files to your Turbo Pascal directory (or directories).
  290.  
  291.                   TOOLINFO.ASC
  292.                   TOOLDOC.ASC
  293.                   CRT2DEMO.PAS
  294.                   CRT2.TPU
  295.                   INPUT.TPU
  296.                   STRFUNCS.TPU
  297.                   KEYS.TPU
  298.  
  299.          D. Installation
  300.                There is an installation program provided on disk to copy
  301.             and rename the appropriate Turbo Tools file to your Turbo
  302.             Pascal directory(ies). For instructions, change to the drive
  303.             with the Turbo Tools disk and enter README at the DOS prompt.
  304.  
  305.          E. Using units
  306.                Turbo Tools 1.0 consists of four units: Crt2, Input,
  307.             StrFuncs, and Keys. These units can be used just like the
  308.             Turbo Pascal units Crt, Dos, Printer, and Graph. Simply
  309.             specify the name of the unit you want access to in the USES
  310.             clause:
  311.  
  312.                program Example;
  313.  
  314.                uses
  315.                  crt,      { TURBO PASCAL SCREEN LIBRARY }
  316.                  Crt2,     { TURBO TOOLS SCR. LIB. TO SUPPLEMENT Crt }
  317.                  StrFuncs; { TURBO TOOLS STRING LIBRARY }
  318.  
  319.      II. unit Crt2
  320.  
  321.          A. Explanation
  322.                Crt2 acts as an extension to Turbo Pascal's Crt unit. All
  323.             the routines and variables are concerned with text screens,
  324.             sound, and single key input. All the routines work in any text
  325.             mode you set with Crt's TextMode procedure and any window you
  326.             create with Crt's Window procedure. To make Crt2 available to
  327.             your programs insert Crt2 in the USES clause.
  328.  
  329.             Example:
  330.                       uses
  331.                         crt,
  332.                         Crt2;
  333.  
  334.                You should be familiar with the Crt unit before you learn
  335.             how to use Crt2. Especially the TextMode and Window procedures
  336.             which are referred to in this part of the manual.
  337.  
  338.          B. Initialization Code
  339.                Every unit can have initialization code, although it
  340.             doesn't have to. Initialization code executes before the
  341.             program that uses it does. See the Turbo Pascal Reference
  342.             Manual for more specifics.
  343.                Crt2's initialization code does several things. It sets up
  344.             the exit code (see next heading), initializes the variable's
  345.             ScrLength, ScrWidth, and VideoSeg, and it sets the cursor to
  346.             normal height using the procedure Cursor declared in this
  347.             unit.
  348.  
  349.          C. Exit Code
  350.                Every unit can have exit code, although it doesn't have to.
  351.             Exit code executes after the program that uses it terminates.
  352.             See the Turbo Pascal Reference Manual for more specifics.
  353.                Crt2 has exit code and it does only one thing: makes a call
  354.             to the Cursor procedure to set the cursor to normal height
  355.             (the same as the initialization code does).
  356.  
  357.          D. Center
  358.  
  359.             1) DECLARATION: procedure Center(st : string) : string;
  360.  
  361.             2) PURPOSE: For centering text on the screen.
  362.  
  363.             3) EXPLANATION: Center returns the string it is given with
  364.                leading spaces inserted so that when printed in the current
  365.                window it will be centered.
  366.  
  367.             4) EXAMPLE:
  368.                   uses crt,Crt2;
  369.                   begin
  370.                     window(10,5,70,20);
  371.                     writeln(Center('This is centered.'));
  372.                     while readkey=#0 do; { WAIT FOR A KEY TO BE PRESSED }
  373.                   end.
  374.  
  375.          E. CanUseColor
  376.  
  377.             1) DECLARATION: function CanUseColor : boolean;
  378.  
  379.             2) PURPOSE: Returns true if color is available, false if not.
  380.  
  381.             3) EXPLANATION: CanUseColor returns true if the video adapter
  382.                has color capabilities. It does not detect monochrome
  383.                (black and white) monitors. A user could have an EGA color
  384.                card, but a EGA monochrome display. In this case, the
  385.                different colors would just appear as different shades of
  386.                gray.
  387.  
  388.             4) EXAMPLE: This example directly sets the current text colors
  389.                instead of using the Crt routines TextColor and
  390.                TextBackground. For an explanation of TextAttr, look it up
  391.                in the index of your Turbo Pascal Reference Manual.
  392.  
  393.                   uses crt,Crt2
  394.                   begin
  395.                     if CanUseColor then
  396.                       textattr := lightgray + blue*16
  397.                     else
  398.                       textattr := lightgray + black*16;
  399.                     { IF COLOR THEN LIGHTGRAY ON BLUE,
  400.                                ELSE LIGHTGRAY ON BLACK }
  401.  
  402.          F. Cursor/CursorState/CursorTypes
  403.  
  404.             1) DECLARATION:
  405.                type CursorTypes = (CursorOff,NormalCursor,
  406.                                    HalfCursor, FullCursor);
  407.                var CursorState : CursorTypes;
  408.                procedure Cursor(Mask : CursorTypes);
  409.  
  410.             2) PURPOSE: The Cursor procedure is used to set the cursor
  411.                appearance. The CursorState variable is used to hold the
  412.                current appearance of the cursor. The CursorTypes type is
  413.                used for declaring CursorState and Cursor's single
  414.                parameter.
  415.  
  416.             3) EXPLANATION: There are four different ways you can call the
  417.                procedure Cursor:
  418.                      Cursor(CursorOff);
  419.                      Cursor(NormalCursor);
  420.                      Cursor(HalfCursor);
  421.                      Cursor(FullCursor);
  422.                The first call hides the cursor so that it can't be seen.
  423.                The second sets the cursor to normal height (the same as
  424.                the cursor in Turbo Pascal's editor). The third sets the
  425.                cursor to half height like the cursor you normally see in a
  426.                word processor when insert mode is on. Full cursor sets the
  427.                cursor to full block height.
  428.                   The variable CursorState is set by the Cursor procedure
  429.                to hold the current appearance of the cursor. You can check
  430.                this variable with If statements and Case clauses.
  431.                   The type CursorTypes is used to declare the variable
  432.                CursorState and Cursor's single parameter. You can define
  433.                your own variables of type CursorTypes and save the value
  434.                of CursorState for later restoration of the cursor (see
  435.                example).
  436.  
  437.             4) INIT CODE: The initialization code of Crt2 sets the cursor
  438.                to normal height using this procedure.
  439.  
  440.             5) EXIT CODE: The exit code does the same. You don't have to
  441.                worry about making sure the cursor is visible or normal
  442.                before terminating your program, because the unit will take
  443.                care of that for you.
  444.  
  445.             6) EXAMPLE:
  446.                   uses crt,Crt2;
  447.                   var
  448.                     x,y : byte;
  449.                     FileName : string[13];
  450.                   
  451.                   procedure WriteStatusLine;
  452.                   var
  453.                     SaveCursor : CursorTypes;
  454.                     SaveX,SaveY : byte;
  455.                   begin
  456.                     SaveCursor := CursorState;
  457.                       {SAVE CURRENT STATE OF CURSOR}
  458.                     SaveX := wherex;  SaveY := wherey;
  459.                     Cursor(CursorOff);
  460.                     gotoxy(1,2); write(x,' ',y,' ',FileName);
  461.                     gotoxy(SaveX,SaveY);
  462.                     Cursor(SaveCursor);
  463.                       { RESTORE CURSOR TO PREVIOUS STATE }
  464.                   end; { WriteStatusLine }
  465.                   
  466.                   begin
  467.                     FileName := 'NONAME.PAS';
  468.                     StatusLine;
  469.                   end. 
  470.  
  471.          G. DelChar 
  472.  
  473.             1) DECLARATION: procedure DelChar(Count : byte); 
  474.  
  475.             2) PURPOSE: Deletes one or more characters from the current
  476.                line. 
  477.  
  478.             3) EXPLANATION: DelChar is the column complement to Crt's
  479.                DelLine procedure. Use the count parameter to specify how
  480.                many characters to delete. The procedure affects only the
  481.                line the cursor is positioned on, works fine in windows,
  482.                and does not affect the cursor position. 
  483.  
  484.             4) SEE ALSO: InsSpace 
  485.  
  486.             5) EXAMPLE:
  487.                   uses crt,Crt2;
  488.                   begin
  489.                     clrscr;
  490.                     writeln('Delete the first word');
  491.                     while readkey=#0 do; { WAIT FOR KEY A TO BE PRESSED }
  492.                     gotoxy(1,1);
  493.                     DelChar(7); {the first word}
  494.                     while readkey=#0 do;
  495.                   end. 
  496.  
  497.          H. Frame 
  498.  
  499.             1) DECLARATION:
  500.                 procedure Frame(x1,y1,x2,y2,Top,Bottom,Left,Right : byte);
  501.  
  502.             2) PURPOSE: Draws a frame on the screen. 
  503.  
  504.             3) EXPLANATION: The Frame procedure uses special ASCII
  505.                characters to draw frames just like the ones found in the
  506.                Turbo Pascal Environment surrounding popup windows and
  507.                menus. x1,y1 specifies the upper left hand corner's
  508.                coordinates and x2,y2 the lower right. Each side of the
  509.                frame can be drawn with a single or double line. Specify
  510.                either 1 or 2 for the last four parameters to control this.
  511.                Frame does not affect the cursor position or appearance in
  512.                any way. 
  513.  
  514.             4) EXAMPLE:
  515.                   uses crt,Crt2;
  516.                   begin
  517.                     clrscr;
  518.                     Frame(1,1,80,25, 1,1,1,1); {ALL SIDE ARE SINGLE LINED}
  519.                     Frame(3,3,40,10, 2,2,1,1); {TOP AND BOTTOM DOUBLE}
  520.                     Frame(45,3,75,12, 2,2,2,2);{ALL SIDES DOUBLE}
  521.                     Frame(3,13,78,24, 2,1,2,1);{TOP AND LEFT DOUBLE}
  522.                     while readkey=#0 do; { WAIT UNTIL A KEY IS PRESSED }
  523.                   end. 
  524.  
  525.          I. GetKey/GetKeyUp 
  526.  
  527.             1) DECLARATION:
  528.                   type SetOfChar = set of char;
  529.                   function GetKey(Acceptable : SetOfChar) : char;
  530.                   function GetKeyUp(Acceptable : SetOfChar) : char; 
  531.  
  532.             2) PURPOSE: Filtered single key input. 
  533.  
  534.             3) EXPLANATION: GetKey works the same as Crt's ReadKey
  535.                function except that GetKey accepts only the input you want
  536.                it to. For instance, if you gave GetKey the set ['0'..'9']
  537.                it would only return one of those values. If the user
  538.                pressed A, GetKey would ignore it and wait for another key.
  539.                GetKeyUp is the same as GetKey except that it converts
  540.                input into upper case letters before it checks to see if it
  541.                is acceptable. 
  542.  
  543.             4) EXAMPLE: Note that #27 is the ASCII code for the ESCAPE
  544.                key.
  545.                
  546.                   uses crt,Crt2;
  547.                   procedure Choice1; begin end;
  548.                   procedure Choice2; begin end;
  549.                   procedure Choice3; begin end;
  550.                   procedure Choice4; begin end;
  551.                
  552.                   begin
  553.                     while true do begin { REPEAT INDEFINITELY }
  554.                       writeln('MENU');
  555.                       { PUT MENU HERE }
  556.                       case GetKey(['1'..'4',#27]) of {A NUMBER OR ESCAPE}
  557.                         '1' : Choice1;
  558.                         '2' : Choice2;
  559.                         '3' : Choice3;
  560.                         '4' : Choice4;
  561.                         #27 : halt;
  562.                       end; { case }
  563.                     end; { while }
  564.                   end.
  565.  
  566.          J. GlobalX/GlobalY 
  567.  
  568.             1) DECLARATION: function GlobalX : byte;
  569.                             function GlobalY : byte; 
  570.  
  571.             2) PURPOSE: Returns the coordinates of the cursor position
  572.                relative to the screen, not the current window. 
  573.  
  574.             3) EXPLANATION: Turbo Pascal's Crt unit provides the functions
  575.                WhereX and WhereY for the cursor position in the current
  576.                window. GlobalX and GlobalY return the cursor position for
  577.                the screen regardless of where and how big the current
  578.                window is. GlobalX and GlobalY were intended for use with
  579.                direct video writing which is explained with the variable
  580.                VideoSeg. 
  581.  
  582.             4) SEE ALSO: var VideoSeg 
  583.  
  584.             5) EXAMPLE:
  585.                   uses crt,Crt2;
  586.                   begin
  587.                     window(10,5,40,20);
  588.                     write('Window 10,5 and 40,20');
  589.                     write('WhereX,WhereY = ',wherex,',',wherey);
  590.                     write('GlobalX,GlobalY = ',GlobalX,',',GlobalY);
  591.                     while readkey=#0 do; { WAIT FOR A KEY TO BE PRESSED }
  592.                   end. 
  593.  
  594.          K. InsSpace 
  595.  
  596.             1) DECLARATION: procedure InsSpace(Count : byte); 
  597.  
  598.             2) PURPOSE: Inserts one or more spaces into the current line. 
  599.  
  600.             3) EXPLANATION: InsSpace is the column complement to Crt's
  601.                InsLine procedure. Use the Count parameter to specify how
  602.                many spaces to insert. The procedure affects only the line
  603.                the cursor is positioned on, works fine in windows, and
  604.                does not affect the cursor position. 
  605.  
  606.             4) SEE ALSO: DelChar
  607.  
  608.             5) EXAMPLE:
  609.                   uses crt,Crt2;
  610.                   begin
  611.                     clrscr;
  612.                     writeln('the first word');
  613.                     while readkey=#0 do; { WAIT FOR KEY TO BE PRESSED }
  614.                     gotoxy(1,1);
  615.                      {the first word}
  616.                     InsSpace(7);
  617.                      {       the first word}
  618.                     while readkey=#0 do;
  619.                     write('Insert');
  620.                     while readkey=#0 do;
  621.                   end. 
  622.  
  623.          L. LowBeep 
  624.  
  625.             1) DECLARATION: procedure LowBeep; 
  626.  
  627.             2) PURPOSE: Emits a low pitched beep from the speaker.
  628.  
  629.             3) EXPLANATION: LowBeep is the simplest routine in this unit.
  630.                It's purpose is to replace write(^G) which produces a very
  631.                high pitched annoying tone. 
  632.  
  633.             4) EXAMPLE:
  634.                   uses crt,Crt2;
  635.                   begin
  636.                     write('Hurts my ears!',^G); 
  637.                     while readkey=#0 do; { WAIT FOR A KEY TO BE PRESSED }
  638.                     write('Much better!'); LowBeep;
  639.                     while readkey=#0 do;
  640.                   end. 
  641.  
  642.          M. ScrWidth/ScrLength 
  643.  
  644.             1) DECLARATION: var ScrWidth,
  645.                                 ScrLength : byte; 
  646.  
  647.             2) PURPOSE: Contains the current width and length of the text
  648.                screen.
  649.  
  650.             3) EXPLANATION: ScrWidth is the width of the screen in
  651.                columns. ScrLength is the length of the screen in rows.
  652.                ScrWidth will always be either 40 or 80. ScrLength will
  653.                always be either 25, 43, or 50. The really useful one out
  654.                of this pair is ScrLength since the Crt variable LastMode
  655.                won't give you specific enough information to tell you the
  656.                difference between EGA 43 line and VGA 50 line text modes.
  657.                Whenever you make a call to Crt's TextMode procedure, Crt2
  658.                will update the values of these two variables. 
  659.  
  660.             4) EXAMPLE:
  661.                   uses crt,Crt2;
  662.                   begin
  663.                     gotoxy(1,ScrLength);
  664.                     write('Press any key to continue...');
  665.                     while readkey=#0 do;
  666.                   end. 
  667.  
  668.          N. VideoSeg 
  669.  
  670.             1) DECLARATION: var VideoSeg : word; 
  671.  
  672.             2) PURPOSE: Holds the segment address of the video buffer. 
  673.  
  674.             3) EXPLANATION:
  675.                   Before reading this section it would be to your
  676.                advantage to look up the varaibles TextAttr and Mem in your
  677.                Turbo Pascal Manual's Index and read about them.
  678.                   The contents of the screen are stored in a buffer that
  679.                is located in between 640K and the 1MB mark. Using Turbo
  680.                Pascal's Mem and MemW array, you can directly set the
  681.                contents to change the screen. It is a tedious method, but
  682.                it provides much faster output that Write. It is usually
  683.                used in only loops. The reason it is faster is because the
  684.                cursor position is not changed and the boundaries of the
  685.                current window are taken into consideration. One problem
  686.                with this method is that the video buffer's location
  687.                differs depending on the video adapter. This is solved with
  688.                the VideoSeg variable which is set by Crt2's intialization
  689.                code to the correct location.
  690.                   The video buffer in text mode consists of bytes
  691.                dedicated to characters and text attributes. For
  692.                information about the format of a text attribute look up
  693.                the explanation of TextAttr in the Turbo Pascal Reference
  694.                Manual (see the index). The first byte of the buffer is the
  695.                ASCII code of the first character on the screen. The byte
  696.                after that is the text attribute of that character. In
  697.                other words, it looks something like this:
  698.                
  699.                   column:  1 |2 |3 |4 |5 |6 |7 |
  700.                   holds:   CA|CA|CA|CA|CA|CA|CA|
  701.                
  702.                   Every C and A represents one byte of memory dedicated to
  703.                an ASCII code or text attribute, respectively. To access
  704.                one of the C's in this array-type structure use this
  705.                format:
  706.                
  707.                      mem[VideoSeg:2*(y*ScrWidth + x)]
  708.                
  709.                   To access an A (text attribute) add one to the offset:
  710.                
  711.                      mem[VideoSeg:2*(y*ScrWidth + x) + 1]
  712.                
  713.                   Since Mem is a variable you can assign a value to it
  714.                (direct write) or assign it to a variable or use it in an
  715.                expression (direct read). VideoSeg and ScrLength are both
  716.                Crt2 variables. The x,y coordinates (which you fill in) are
  717.                different than the kind you would use with GotoXY or Frame.
  718.                First of all, the upper left hand corner is not 1,1; it's
  719.                0,0. Also, the coordinates are not relative to the current
  720.                window. To access an attribute simply add 1 to x. Remember
  721.                that you can write to any screen location regardless of
  722.                where the cursor is, and after the write the cursor
  723.                position is not changed. 
  724.  
  725.             4) EXAMPLES:
  726.                
  727.                TO WRITE A CHARACTER AT POSITION X,Y
  728.                   mem[VideoSeg:2*(y*ScrLength + x)] := ord('A');
  729.                
  730.                TO WRITE AN ATTRIBUTE AT POSITON X,Y
  731.                   mem[VideoSeg:2*(y*ScrLength + x) + 1]
  732.                      := lightgray + blue*16;
  733.                
  734.                TO WRITE BOTH A CHARACTER AND ATTRIBUTE (NOTE THE w)
  735.                   memw[VideoSeg:2*(y*ScrLength + x)]
  736.                      := ord('A') + (lightgray + blue*16)*256;
  737.                
  738.                TO RETRIEVE A CHARACTER FROM A SCREEN POSITION:
  739.                   var c : char;
  740.                   c := chr(mem[VideoSeg:2*(y*ScrLength + x)]);
  741.                
  742.                TO RETRIEVE AN ATTRIBUTE FROM A SCREEN POSITON:
  743.                   var a : byte;
  744.                   a := mem[VideoSeg:2*(y*ScrLength + x) + 1];
  745.                
  746.                TO WRITE AN ATTRIBUTE AT THE CURRENT CURSOR POSITION:
  747.                   mem[VideoSeg:2*((GlobalY-1)*ScrWidth + GlobalX)]
  748.                      := ord('A'); 
  749.  
  750.          O. WriteLast 
  751.  
  752.             1) DECLARATION: procedure WriteLast(ch : char); 
  753.  
  754.             2) PURPOSE: Write a character in the lower right hand corner
  755.                without scrolling the window. 
  756.  
  757.             3) EXPLANATION: Occasionally you may need to put a character
  758.                in the lower right hand corner of the screen (or current
  759.                window) but a Write at that position will always make the
  760.                screen scroll up. If this is undesired use WriteLast. It
  761.                will put the given character in the corner without any
  762.                scrolling effect and the cursor position will not change.
  763.                WriteLast uses the current text colors to write the
  764.                character the same as Write or Writeln. 
  765.  
  766.             4) EXAMPLE:
  767.                   uses crt,Crt2;
  768.                   begin
  769.                     if CanUseColor then textmode(co80);
  770.                     clrscr;
  771.                     writeln('You can''t see this because it scrolls ',
  772.                             'off!');
  773.                     gotoxy(25,80); write(#219);
  774.                     while readkey=#0 do; { WAIT FOR A KEY TO BE PRESSED }
  775.                     clrscr;
  776.                     writeln('This stays on the screen!');
  777.                     WriteLast(#219);
  778.                     while readkey=#0 do;
  779.                   end. 
  780.  
  781.     III. unit Input 
  782.  
  783.          A. Word of warning
  784.                It will be much easier for you if you read all of Part III
  785.             BEFORE using the Input unit. Many of the items in this unit
  786.             are closely intertwined and it will be to your benefit to read
  787.             about all of them before putting anything to work. 
  788.  
  789.          B. Explanation
  790.                Turbo Pascal provides Readln for keyboard input, but most
  791.             programmers find it very unpractical. The unit Input consists
  792.             of bullet proof, flexible input routines for all integer types
  793.             and strings. All routines are functions, so you must assign
  794.             the function to a variable, or use it in an IF or CASE
  795.             statement. All routines begin with "Read" and continue with
  796.             the exact name of the data type that is going to be read (for
  797.             example ReadLongInt). The only exception to the naming
  798.             convention is ReadStr which is for string input. The unit also
  799.             contains constants such as MinByte and MaxWord so you don't
  800.             have to memorize the ranges of the different integer types.
  801.             These constants can be used with the integer input routines.
  802.                NOTE: The unit Crt2 also contains two input routines:
  803.             GetKey and GetKeyUp. See Part II. 
  804.  
  805.          C. Initialization and Exit Code
  806.                Input has no initialization or exit code. 
  807.  
  808.          D. Escaped 
  809.  
  810.             1) DECLARATION: var Escaped : boolean; 
  811.  
  812.             2) PURPOSE: Equals TRUE if the user escaped from the last
  813.                input routine. 
  814.  
  815.             3) EXPLANATION: This variable is set to TRUE if the user
  816.                pressed an escape key to get out of an input routine
  817.                instead of pressing ENTER. And of course if the user
  818.                pressed ENTER, then Escaped is set to false. Note that what
  819.                constitutes an escape key is determined by the programmer.
  820.                Every input routine in this unit allows the programmer to
  821.                define two sets of escape keys. The first set is for normal
  822.                keys such as ESCAPE that send only one ASCII code to the
  823.                computer. The second set is for specifying the extended
  824.                keys that send two ASCII codes to the computer (an ASCII
  825.                code of zero to signify an extended code and then a second
  826.                ASCII code which tells the program what key was pressed).
  827.                Examples of extended codes are F1, HOME, and LEFT ARROW.
  828.                Look up ReadKey in the Turbo Pascal Reference Manual for
  829.                more information. If you do not want the user to be able to
  830.                exit the input routine then leave the two sets empty (
  831.                [],[] ). The other sections will have more information. 
  832.  
  833.             4) EXAMPLE: Note that #27 is the ASCII code for the ESCAPE
  834.                key.
  835.                
  836.                   uses 
  837.                     Input;
  838.                   var 
  839.                     Name : string;
  840.                   begin
  841.                     write('Enter your name: ');
  842.                     Name := ReadStr(25,AllChars,[#27],[]);
  843.                     if Escaped then begin
  844.                       writeln('PROGRAM TERMINATED BY USER.');
  845.                       halt;
  846.                     end; { if }
  847.                     writeln;
  848.                     writeln('Hello, ',Name);
  849.                   end. 
  850.  
  851.          E. Minimum/Maximum integer range constants 
  852.  
  853.             1) DECLARATION:
  854.                  const
  855.                    MinShortInt =        -128;
  856.                    MaxShortInt =         127;
  857.                    MinByte     =           0;
  858.                    MaxByte     =         255;
  859.                    MinInt      =      -32768;
  860.                  { MaxInt      =       32767; }
  861.                    MinWord     =           0;
  862.                    MaxWord     =       65535;
  863.                    MinLongInt  = -2147483468;
  864.                  { MaxLongInt  =  2147483467; } 
  865.  
  866.             2) PURPOSE: Saves the programmer from having to memorize the
  867.                ranges of the different integer types. 
  868.  
  869.             3) EXPLANATION: Turbo Pascal has to predefined constants,
  870.                MaxInt and MaxLongInt, that are equal to the maximum ranges
  871.                of the Integer and LongInt types. This was a good idea,
  872.                except that someone at Borland forgot about the minimum
  873.                ranges as well as the other integer types. 
  874.  
  875.             4) EXAMPLE: Note that #27 is the ASCII code for the ESCAPE
  876.                key.
  877.                
  878.                uses
  879.                  crt,
  880.                  Input;
  881.                
  882.                var
  883.                  EndOfLoop,
  884.                  s : word;
  885.                
  886.                begin
  887.                  clrscr;
  888.                  while true do begin
  889.                    writeln('Enter a number greater than 100.');
  890.                    writeln('Or press ESCAPE to quit.');
  891.                    EndOfLoop := ReadWord(101,MaxWord,0,5,[#27],[]);
  892.                    writeln;
  893.                    writeln;
  894.                    if Escaped then halt;
  895.                    for s := 1 to EndOfLoop do begin
  896.                      sound(s);
  897.                      delay(3);
  898.                    end; { for }
  899.                    nosound;
  900.                  end; { while }
  901.                end. 
  902.  
  903.          F. Integer input routines 
  904.  
  905.             1) DECLARATION:
  906.                type SetOfChar = set of char;
  907.                
  908.                function ReadByte(Min,Max,Init : shorting; Field : byte;
  909.                                    EscapeBy,ExtEscape : SetOfChar) : byte;
  910.                
  911.                ReadShortInt
  912.                ReadByte
  913.                ReadInteger
  914.                ReadWord
  915.                ReadLongInt
  916.                
  917.                All integer input routines are defined with exactly the
  918.                same parameters. 
  919.  
  920.             2) PURPOSE: Replacement input routines for Readln. 
  921.  
  922.             3) EXPLANATION:
  923.                   The integer input routines offer you more features and
  924.                are more sound proof than Turbo Pascal's Readln. Each one
  925.                works exactly the same except that it returns a different
  926.                integer type. None of the routines allow the user to type
  927.                anything but digits (0..9) and a negative sign. Unlike
  928.                Readln, the input routines won't allow users to enter
  929.                things line '-1-3' or 'a' which would cause runtime errors.
  930.                   The Min and Max parameters let you set a range of values
  931.                that the user can enter. If he enters something outside the
  932.                range and presses ENTER the Crt2 LowBeep procedure will be
  933.                called and the routine will wait for more input. If you
  934.                want the user to be able to enter any number that will fit
  935.                in an integer type use 0,0. The integer range constants are
  936.                also at your disposal.
  937.                   The Init parameter is the initial value that you want
  938.                the input field to be initialized with. If there is no
  939.                specific value you want, then just specify zero.
  940.                   The Field parameter tells the input routine how many
  941.                characters wide the input field is to be. The length of the
  942.                number in digits will be restricted to the field length.
  943.                Make sure you give the field enough columns so that the Min
  944.                and Max values can be entered. Don't forget that the
  945.                negative sign requires a space.
  946.                   EscapeBy is a set of characters such as [#27],
  947.                ['A'..'Z'], and ['A'..'D','Q']. If the user presses a key
  948.                that is found in this set, then the input routine will
  949.                stop. It will return the value of Init and the variable
  950.                Escaped will be set to True. If you don't want the user to
  951.                be able to escape then pass [], which is an empty set.
  952.                   EscapeExt is another set of characters for special keys
  953.                that first return a ASCII code zero and then another ASCII
  954.                code that represents the key. This set is in case you
  955.                wanted the user to be able to exit with F1 or DELETE, or
  956.                some other key that uses an extended code.
  957.                   When an integer input routine is called the field will
  958.                be cleared and initialized with the value of Init. The
  959.                routine will then wait for input. Numbers are entered just
  960.                like a calculator, except that a negative sign must be
  961.                entered first. BACKSPACE can be used for corrections. If
  962.                the user presses ENTER, the function checks to see if the
  963.                number is in range. If not, the speaker beeps and the
  964.                routine waits for corrections. If so, the function sets the
  965.                variable Escaped to False and returns the number. Whether
  966.                the user presses ENTER or an escape key the cursor will NOT
  967.                go to the next line, like in Readln. It will stay at the
  968.                end of the field. Make sure that you don't make the field
  969.                length longer than the space left on the current line or
  970.                there will be problems.
  971.                   For defining the EscapeBy and EscapeExt character sets,
  972.                you will probably want to use the unit Keys. See part IV. 
  973.  
  974.             4) SEE ALSO: Part IV. Keys 
  975.  
  976.             5) EXAMPLE:
  977.                   uses
  978.                     dos,
  979.                     Input;
  980.                
  981.                   var
  982.                     Month,Day,Year,DayOfWeek : word;
  983.                     Age : byte;
  984.                
  985.                   begin
  986.                     getdate(Month,Day,Year,DayOfWeek);
  987.                     while true do begin
  988.                       write('Enter your age, or ESCAPE to quit: ');
  989.                       Age := ReadByte(0,120,0,2,[#27],[]);
  990.                       writeln;
  991.                       if Escaped then halt;
  992.                       writeln('In the year 2000 you will be ',
  993.                               2000-Year + Age,' years old.');
  994.                       writeln('In the year 2020 you will be ',
  995.                               2020-Year + Age,' years old.');
  996.                     end; { while }
  997.                   end.
  998.  
  999.          G. ReadStr
  1000.  
  1001.             1) DECLARATION:
  1002.                function ReadStr(MaxLen : byte; Acceptable,
  1003.                                 EscapeBy,ExtEscape : SetOfChar) : string;
  1004.  
  1005.             2) PURPOSE: Replacement input routine for Readln.
  1006.  
  1007.             3) EXPLANATION:
  1008.                   The ReadStr input routine offers more features and is
  1009.                more sound proof than Turbo Pascal's Readln.
  1010.                   The MaxLen parameter specifies how many characters long
  1011.                the user's input can be. String input can span over more
  1012.                than one line, unlike the integer input routines. If the
  1013.                user reaches the end of his available length and continues
  1014.                to type on the keyboard the cursor will simple stay put.
  1015.                   The Acceptable parameter works the same as GetKey and
  1016.                GetKeyUp's Acceptable parameter (in the Crt2 unit).
  1017.                Acceptable is a set of characters such as
  1018.                ['A'..'Z','a'..'z'] which will be the only characters that
  1019.                are allowed to be typed by the user. If a character is
  1020.                received by ReadStr that is not found in Acceptable it will
  1021.                be ignored. You can use the constant AllChars to let the
  1022.                user enter anything.
  1023.                   EscapeBy and ExtEscape work exactly the same as with the
  1024.                integer input routines.
  1025.                   EscapeBy is a set of characters such as [#27],
  1026.                ['A'..'Z'], and ['A'..'D','Q']. If the user presses a key
  1027.                that is found in this set, then the input routine will
  1028.                stop. It will return an empty string and the variable
  1029.                Escaped will be set to True. If you don't want the user to
  1030.                be able to escape then pass [], which is an empty set.
  1031.                   EscapeExt is another set of characters for special keys
  1032.                that first return ASCII code zero and then another ASCII
  1033.                code that represents the key pressed. This set is in case
  1034.                you wanted the user to be able to exit with F1 or DELETE,
  1035.                or some other key that uses an extended code.
  1036.                   ReadStr let's the user corret errors with BACKSPACE the
  1037.                same as Readln. Note that because Turbo Pascal does not
  1038.                allow strings to be used with Case clauses, ReadStr cannot
  1039.                be used there either (since it returns a string). However,
  1040.                the function can be used in If statements. 
  1041.  
  1042.             4) SEE ALSO: const AllChars (next letter) 
  1043.  
  1044.             5) EXAMPLE:
  1045.                   uses Input;
  1046.                   var Name : string[15];
  1047.                   begin
  1048.                     writeln('What is your name?');
  1049.                     Name := ReadStr(15,['A'..'Z','a'..'z'],[],[]);
  1050.                     writeln;
  1051.                     writeln('Hello, ',Name);
  1052.                   end.
  1053.  
  1054.          H. AllChars
  1055.  
  1056.             1) DECLARATION: const AllChars : set of char = [#32..#254];
  1057.  
  1058.             2) PURPOSE: For use with ReadStr. 
  1059.  
  1060.             3) EXPLANATION: Many times when using ReadStr you will want to
  1061.                let the user enter any character. In this case pass
  1062.                AllChars for the ReadStr parameter, Acceptable. 
  1063.  
  1064.             4) EXAMPLE:
  1065.                This example program also demonstrates that you don't have
  1066.                to assign an input function a variable. You can use the
  1067.                function anywhere its data type is expected, including if
  1068.                and case statements, Writelns, and procedure and function
  1069.                parameters.
  1070.                
  1071.                   program Typewriter;
  1072.                
  1073.                   uses
  1074.                     printer,
  1075.                     Input;
  1076.                   
  1077.                   begin
  1078.                     writeln('Press ESCAPE to quit. Anything else is');
  1079.                     writeln('sent to the printer.');
  1080.                     while true do begin
  1081.                       writeln(lst,ReadStr(40,AllChars,[#27],[]));
  1082.                       writeln;
  1083.                       if Escaped then begin
  1084.                         writeln;
  1085.                         halt;
  1086.                       end;
  1087.                     end; { while }
  1088.                   end. 
  1089.  
  1090.      IV. unit Keys 
  1091.  
  1092.          A. Explanation
  1093.                The unit Keys consists of 123 constants which represent
  1094.             most of the special keys that you would want to recognize from
  1095.             the keyboard. Examples are the arrow keys, the function keys,
  1096.             and CONTROL and ALTERNATE shift combinations. Instead of
  1097.             memorizing these ASCII codes or looking them up in a table you
  1098.             can simply use the constants defined in Keys.
  1099.                Note that most of the special keys are extended codes: the
  1100.             first call to ReadKey will return a #0, and a second call will
  1101.             return another ASCII code that identifies the input. See
  1102.             ReadKey in the Turbo Pascal Reference Manual for more
  1103.             information on getting extended codes.
  1104.                Note that the F11 and F12 keys and there complements are
  1105.             only applicable to the IBM PS/2 keyboards and compatibles.
  1106.             These are also know as 101-keyboards and extended keyboards.
  1107.             The Ctr key is the middle key on the numeric keypad labeled 5.
  1108.             It DOES return an extended keyboard code when the keyboard
  1109.             isn't in numerics lock despite what most people believe. The
  1110.             constant _Extended is the first ASCII code returned by
  1111.             extended keys (#0). 
  1112.  
  1113.          B. Constant Identifiers 
  1114.  
  1115.             1) Single Code Special Keys
  1116.                   _Backspace  _Enter  _Escape  _Tab _Extended 
  1117.  
  1118.             2) Extended Code Special Keys
  1119.                   _ShiftTab
  1120.                
  1121.                   _Up         _CtrlUp     _AltUp
  1122.                   _Down       _CtrlDown   _AltDown
  1123.                   _Left       _CtrlLeft   _AltLeft
  1124.                   _Right
  1125.                   _Home
  1126.                   _End
  1127.                   _PageUp
  1128.                   _PageDown
  1129.                   _Ins
  1130.                   _Del
  1131.                   _Ctr
  1132.                
  1133.                   _F1.._F12
  1134.                   _ShiftF1.._ShiftF12
  1135.                   _CtrlF1.._CtrlF12
  1136.                   _AltF1.._AltF12
  1137.                
  1138.                   _AltA.._AltZ
  1139.                
  1140.                   _Alt1.._Alt0 
  1141.  
  1142.          C. Example
  1143.                uses crt,Keys;
  1144.                begin
  1145.                  case readkey of
  1146.                    _Extended : case readkey of
  1147.                                  _Up    : ;
  1148.                                  _Down  : ;
  1149.                                  _Left  : ;
  1150.                                  _Right : ;
  1151.                                end; { case }
  1152.                    _Enter  : ;
  1153.                    _Escape : ;
  1154.                    #32..#254 : ;
  1155.                  end; { case }
  1156.                end. 
  1157.  
  1158.       V. unit StrFuncs 
  1159.  
  1160.          A. Explanation
  1161.                StrFuncs contains 10 extra string functions to supplement
  1162.             those included with Turbo Pascal. The examples for this unit
  1163.             are not complete programs. They are listings of different ways
  1164.             to call a particular function and what the function would
  1165.             return. Since these functions are very easy to understand, the
  1166.             normal EXPLANATION section that usually accompanies a routine
  1167.             has been cut out. All explaining is done in the PURPOSE
  1168.             section. 
  1169.  
  1170.          B. Initialization and Exit Code
  1171.                StrFuncs has no initialization or exit code. 
  1172.  
  1173.          C. CopyEnd 
  1174.  
  1175.             1) DECLARATION:
  1176.                   function CopyEnd(st : string; x : byte) : string; 
  1177.  
  1178.             2) PURPOSE: Returns the last x bytes of the string st. 
  1179.  
  1180.             3) EXAMPLES:
  1181.                   CopyEnd('StrFuncs',5) = 'Funcs'
  1182.                   CopyEnd('Hello',1) = 'o'
  1183.                   CopyEnd(st,0) = ''
  1184.                   CopyEnd('Turbo Tools',100) = 'Turbo Tools' 
  1185.  
  1186.          D. DelOccurs
  1187.  
  1188.             1) DECLARATION: function DelOccurs(Find,Target : string;
  1189.                                                x : byte) : string; 
  1190.  
  1191.             2) PURPOSE: Returns Target with the first x occurrences of
  1192.                Find deleted. If you want all occurrences of Find deleted
  1193.                specify 255 for x. 
  1194.  
  1195.             3) EXAMPLES:
  1196.                   DelOccurs('x','xyz',1) = 'yz'
  1197.                   DelOccurs('x','xyz',2) = 'yz'
  1198.                   DelOccurs('turbo','hello',1) = 'hello'
  1199.                   DelOccurs('turbo','turbo',1) = ''
  1200.                   DelOccurs('','turbo',1) = 'turbo' 
  1201.  
  1202.          E. LowCase 
  1203.  
  1204.             1) DECLARATION: function LowCase(ch : char) : char;
  1205.  
  1206.             2) PURPOSE: Returns ch as a lower case character. A
  1207.                non-alphabetic character or lower case letter is returned
  1208.                as is. This function is a complement to Turbo Pascal's
  1209.                UpCase function which converts characters to upper case. 
  1210.  
  1211.             3) EXAMPLES:
  1212.                   LowCase('M') = 'm'
  1213.                   LowCase('x') = 'x'
  1214.                   LowCase('1') = '1'  
  1215.  
  1216.          F. LowStr 
  1217.  
  1218.             1) DECLARATION: function LowStr(st : string) : string; 
  1219.  
  1220.             2) PURPOSE: Returns st with all upper case characters
  1221.                converted to lower case. Lower case and non-alphabetic
  1222.                characters are left alone. 
  1223.  
  1224.             3) SEE ALSO: UpStr 
  1225.  
  1226.             4) EXAMPLES:
  1227.                   LowStr('HELLO') = 'hello'
  1228.                   LowStr('ps/2') = 'ps/2'
  1229.                   LowStr('') = ''
  1230.                   LowStr('   ') = '   ' 
  1231.  
  1232.          G. PosOccur 
  1233.  
  1234.             1) DELCARATION:
  1235.                function PosOccur(Find,Target : string; n : byte) : byte; 
  1236.  
  1237.             2) PURPOSE: Returns the position of the n'th occurrence of
  1238.                Find in Target. This function is a complement to Turbo
  1239.                Pascal's Pos function which returns the position of the
  1240.                first occurrence of a string in another string. If there
  1241.                are not n occurrences of Find in Target then a zero is
  1242.                returned. 
  1243.  
  1244.             3) EXAMPLES:
  1245.                   PosOccur('x','x x x',2) = 3
  1246.                   PosOccur('t','What time?',1) = 4
  1247.                   PosOccur('t','What time?',2) = 6
  1248.                   PosOccur('t','What time?',3) = 0
  1249.                   PosOccur('t','What time?',0) = 0
  1250.  
  1251.          H. Occurs 
  1252.  
  1253.             1) DECLARATION: function Occurs(Find,Target : string) : byte; 
  1254.  
  1255.             2) PURPOSE: Returns the number of times Find occurs is Target.
  1256.  
  1257.             3) EXAMPLES:
  1258.                   Occurs('x','x x x') = 3
  1259.                   Occurs('t','What time?') = 2
  1260.                   Occurs('x','y y y') = 0
  1261.                   Occurs('','anything') = 0
  1262.                   Occurs('into nothing','') = 0  
  1263.  
  1264.          I. Shave 
  1265.  
  1266.             1) DECLARATION: function Shave(st : string) : string; 
  1267.  
  1268.             2) PURPOSE: Returns st with all leading and trailing spaces
  1269.                deleted. The ends are "shaved" off. 
  1270.  
  1271.             3) SEE ALSO: function ShaveLead
  1272.                          function ShaveTrail 
  1273.  
  1274.             4) EXAMPLES:
  1275.                   Shave('  now  ') = 'now'
  1276.                   Shave('  abc') = 'abc'
  1277.                   Shave('more examples   ') = 'more examples'
  1278.                   Shave('       ') = ''
  1279.                   Shave('') = '' 
  1280.  
  1281.          J. ShaveLead 
  1282.  
  1283.             1) DECLARATION: function ShaveLead(st : string) : string; 
  1284.  
  1285.             2) PURPOSE: Returns st with all leading spaces deleted.
  1286.                Trailing spaces are left untouched. 
  1287.  
  1288.             3) SEE ALSO: function Shave
  1289.                          function ShaveTrail 
  1290.  
  1291.             4) EXAMPLES:
  1292.                   Shave('  now  ') = 'now  '
  1293.                   Shave('  abc') = 'abc'
  1294.                   Shave('more examples   ') = 'more examples   '
  1295.                   Shave('       ') = ''
  1296.                   Shave('') = '' 
  1297.  
  1298.          K. ShaveTrail 
  1299.  
  1300.             1) DELCARATION: function ShaveTrail(st : string) : string; 
  1301.  
  1302.             2) PURPOSE: Returns st with all trailing spaces deleted.
  1303.                Leading spaces are left untouched. 
  1304.  
  1305.             3) SEE ALSO: function Shave
  1306.                          function ShaveLead 
  1307.  
  1308.             4) EXAMPLES:
  1309.                   Shave('  now  ') = '  now'
  1310.                   Shave('  abc') = '  abc'
  1311.                   Shave('more examples   ') = 'more examples'
  1312.                   Shave('       ') = ''
  1313.                   Shave('') = '' 
  1314.  
  1315.          L. UpStr 
  1316.  
  1317.             1) DECLARATION: function UpStr(st : string) : string; 
  1318.  
  1319.             2) PURPOSE: Returns st with all lower case letters converted
  1320.                to upper case. 
  1321.  
  1322.             3) SEE ALSO: LowStr 
  1323.  
  1324.             4) EXAMPLES:
  1325.                   LowStr('HELLO') = 'HELLO'
  1326.                   LowStr('ps/2') = 'PS/2'
  1327.                   LowStr('') = ''
  1328.                   LowStr('   ') = '   '
  1329.  
  1330. {----------------------------------------------------------------------------}
  1331. {    END OF TOOLINFO.ASC FOR TURBO TOOLS 1.0 (C) 1989 BY CHUCK ESTERBROOK    }
  1332. {----------------------------------------------------------------------------}
  1333.